﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace GPCSC.Web.CL_UMDRP_M
{
    public partial class Modify : Page
    {       

        		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				#warning 代码生成提示：显示页面,请检查确认该语句是否正确
				ShowInfo();
			}
		}
			
	private void ShowInfo()
	{
		GPCSC.BLL.CL_UMDRP_M bll=new GPCSC.BLL.CL_UMDRP_M();
		GPCSC.Model.CL_UMDRP_M model=bll.GetModel();
		this.lblCL_UMDRP_MOID.Text=model.CL_UMDRP_MOID.ToString();
		this.lblCL_USERID_PK.Text=model.CL_USERID_PK.ToString();
		this.lblCL_ROLEID_PK.Text=model.CL_ROLEID_PK.ToString();
		this.lblCL_DepartID_PK.Text=model.CL_DepartID_PK.ToString();
		this.lblCL_POSTID_PK.Text=model.CL_POSTID_PK.ToString();
		this.lblCL_MENUID_PK.Text=model.CL_MENUID_PK.ToString();
		this.lblCL_VALUE_PK.Text=model.CL_VALUE_PK.ToString();
		this.txtENABLE.Text=model.ENABLE.ToString();
		this.txtIsPublic.Text=model.IsPublic.ToString();
		this.txtCREATEDATE.Text=model.CREATEDATE.ToString();
		this.lblCREATERID.Text=model.CREATERID.ToString();
		this.txtCREATERNAME.Text=model.CREATERNAME;
		this.txtEDITDATE.Text=model.EDITDATE.ToString();
		this.lblEDITERID.Text=model.EDITERID.ToString();
		this.txtEDITERNAME.Text=model.EDITERNAME;

	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtENABLE.Text))
			{
				strErr+="ENABLE格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtIsPublic.Text))
			{
				strErr+="IsPublic格式错误！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCREATEDATE.Text))
			{
				strErr+="CREATEDATE格式错误！\\n";	
			}
			if(this.txtCREATERNAME.Text.Trim().Length==0)
			{
				strErr+="CREATERNAME不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtEDITDATE.Text))
			{
				strErr+="EDITDATE格式错误！\\n";	
			}
			if(this.txtEDITERNAME.Text.Trim().Length==0)
			{
				strErr+="EDITERNAME不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			Guid CL_UMDRP_MOID= new Guid(this.lblCL_UMDRP_MOID.Text);
			Guid CL_USERID_PK= new Guid(this.lblCL_USERID_PK.Text);
			Guid CL_ROLEID_PK= new Guid(this.lblCL_ROLEID_PK.Text);
			Guid CL_DepartID_PK= new Guid(this.lblCL_DepartID_PK.Text);
			Guid CL_POSTID_PK= new Guid(this.lblCL_POSTID_PK.Text);
			Guid CL_MENUID_PK= new Guid(this.lblCL_MENUID_PK.Text);
			Guid CL_VALUE_PK= new Guid(this.lblCL_VALUE_PK.Text);
			int ENABLE=int.Parse(this.txtENABLE.Text);
			int IsPublic=int.Parse(this.txtIsPublic.Text);
			DateTime CREATEDATE=DateTime.Parse(this.txtCREATEDATE.Text);
			Guid CREATERID= new Guid(this.lblCREATERID.Text);
			string CREATERNAME=this.txtCREATERNAME.Text;
			DateTime EDITDATE=DateTime.Parse(this.txtEDITDATE.Text);
			Guid EDITERID= new Guid(this.lblEDITERID.Text);
			string EDITERNAME=this.txtEDITERNAME.Text;


			GPCSC.Model.CL_UMDRP_M model=new GPCSC.Model.CL_UMDRP_M();
			model.CL_UMDRP_MOID=CL_UMDRP_MOID;
			model.CL_USERID_PK=CL_USERID_PK;
			model.CL_ROLEID_PK=CL_ROLEID_PK;
			model.CL_DepartID_PK=CL_DepartID_PK;
			model.CL_POSTID_PK=CL_POSTID_PK;
			model.CL_MENUID_PK=CL_MENUID_PK;
			model.CL_VALUE_PK=CL_VALUE_PK;
			model.ENABLE=ENABLE;
			model.IsPublic=IsPublic;
			model.CREATEDATE=CREATEDATE;
			model.CREATERID=CREATERID;
			model.CREATERNAME=CREATERNAME;
			model.EDITDATE=EDITDATE;
			model.EDITERID=EDITERID;
			model.EDITERNAME=EDITERNAME;

			GPCSC.BLL.CL_UMDRP_M bll=new GPCSC.BLL.CL_UMDRP_M();
			bll.Update(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
